(function(win){
	/**
	 * 获取订单进度ajax
	 */
	function getOrderProgress(){
		return axios.get("/admin/getAllStates")
	}
	
	function renderOrderProgress(arr){
		if(!arr || !Array.isArray(arr) || arr.length === 0)return
		var html = ""
		for(var i = 0;i < arr.length;i++){
			var stateCls = "",
				icon = "&#xe807;"
			if(arr[i].state === "已通过"){
				stateCls = "success"
				icon = "&#xe666;"
			}else if(arr[i].state === "有反馈"){
				stateCls = "err"
				icon = "&#xe618;"
			}
			html += "<div class='pro "+ stateCls +"'>"+
					"	<div class='circular'>"+
					"		<i class='iconfont'>"+ icon +"</i>"+
					"	</div>"+
					"	<span class='text'>"+ arr[i].title +"</span>"+
					"</div>";
					
			if(i < arr.length - 1){
				html += "<div class='bor "+ stateCls +"'></div>"
			}
		}
		$("#orderprogress").html(html)
	}
	
	function addMsg(databox,data){
		databox.parent().children(".jkrmsg").remove()
		//添加信息（初审和车辆照片不一样）
		var msgbox = $("<div style='margin-bottom: 10px;overflow: hidden;border: 1px solid #ddd;padding: 5px 0;border-radius: 3px;margin-bottom: 15px;' class='jkrmsg'></div>");
		msgbox.html("<div class='col-md-3'>客户姓名：<span style='color: #999;'>"+ data.name +"</span></div><div class='col-md-4'>客户电话：<span style='color: #999;'>"+ data.phone +"</span></div><div class='col-md-5'>客户身份证号码：<span style='color: #999;'>"+ data.idNo +"</span></div><div class='col-md-4'>业务经理：<span style='color: #999;'>"+ data.userName +"</span></div><div class='col-md-5'>业务经理电话：<span style='color: #999;'>"+ data.userPhone +"</span></div><div class='col-md-3'>审核人：<span style='color: #999;'>"+ data.assessor +"</span></div><div class='col-md-4'>审核时间：<span style='color: #999;'>"+ data.reviewDate +"</span></div>");
		databox.parent().prepend(msgbox);
	}
	
	/**
	 * 模拟bootstrap按钮禁用
	 */
	function disbutton(btnDom){
		var loadingText = btnDom.data("loading-text"),
			innerText = btnDom.data("text",btnDom.text())
		btnDom.addClass("disabled").attr("disabled",true)
	}
	
	win._com = {
		getOrderProgress: getOrderProgress,
		renderOrderProgress: renderOrderProgress,
		addMsg: addMsg,
		disbutton: disbutton
	}
})(window)